import { defineStore } from 'pinia'
/*
 * 全局加载状态
 * @export useLoadingStore
 */
export const useLoadingStore = defineStore('loading', {
  state: () => ({
    // 读取config下的默认配置
    loading: false
  }),
  actions: {
    hide() {
      this.loading = false
      let spins = document.querySelector('.ant-spin-nested-loading') as HTMLElement
      spins.style.zIndex = '999'
    },
    show() {
      this.loading = true
      let spins = document.querySelector('.ant-spin-nested-loading') as HTMLElement
      spins.style.zIndex = '1001'
    }
  }
})
